﻿//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifndef _UXS_TYPES_H
#define _UXS_TYPES_H

#pragma once

#include "../Defines/Init.h"

namespace UX_STL
{
namespace UXTypes
{

	typedef	wchar_t				wchar;
	typedef signed char			int8;
	typedef	signed short		int16;
	typedef signed int			int32;
	typedef	signed long long	int64;

	typedef unsigned char		uint8;
	typedef	unsigned short		uint16;
	typedef unsigned int		uint32;
	typedef unsigned long long	uint64;
	typedef uint32				uint;


// pointer & size type
#if defined PLATFORM_32BIT and not defined UX_DEBUG_64BIT
	typedef uint32				usize;
	typedef int32				isize;
#else
#if defined PLATFORM_64BIT or defined UX_DEBUG_64BIT
	typedef uint64				usize;
	typedef int64				isize;
#endif
#endif


// Null Pointer
#if not defined( UX_NULL_PTR )

namespace _hidden_
{

	struct _TNullPointer
	{
		void operator & () {}
		void operator & () const {}

		template<class T>
		operator T * () const
		{
			return (T *)0;
		}
	
		template<class C, class T>
		operator T C::* () const
		{
			return 0;
		}
	};

	const _TNullPointer	__nullptr = {};

#	define	UX_NULL_PTR		::_hidden_::__nullptr
}

#endif	// UX_NULL_PTR

	
#define null	UX_NULL_PTR


#ifndef UX_DEBUG_64BIT
	STATIC_ASSERT( sizeof(void *) == sizeof(usize),	"unsigned size type is incorrect" );
	STATIC_ASSERT( sizeof(void *) == sizeof(isize),	"signed size type is incorrect" );
#endif

//-------------------------------------------------------------------

}	// UXTypes
}	// UX_STL

#endif	// _UXS_TYPES_H